#ifndef _PROCESSOR_HPP_20120414
#define _PROCESSOR_HPP_20120414

#include "base.hpp"

#include "idatagram.hpp"
#include "iprocessor.hpp"
#include "connection.hpp"

#include "datagram.hpp"
#include <ext/hash_map>

using namespace datagram;

class Processor: public IProcessor
{
	public :
		typedef __gnu_cxx::hash_map<uint32_t, Connection *> ConnMap;
		typedef ConnMap::iterator ConnMap_Iter;
		typedef ConnMap::const_iterator ConnMap_CIter;

	public :
		Processor() {}
		virtual ~Processor()
		{
		}

		virtual void accept(Connection & conn);
		virtual void remove(Connection & conn);

		virtual void process_input(Connection & conn, IDatagram & datagram);

		int send_datagram(IDatagram & datagram);

	private :
		void process(Connection & conn, const DatagramTest1Resp & resp);
	public :
		ConnMap _conn_map;
};

#endif

